<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <title>学生管理</title>
    <style>
        td{
            line-height: 40px;
            text-align: center;
        }
        tr th{
            text-align: center;
        }
    </style>
    <!--favicon-->
    <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon">
    <!-- simplebar CSS-->
    <link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet"/>
    <!-- Bootstrap core CSS-->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet"/>
    <!-- animate CSS-->
    <link href="assets/css/animate.css" rel="stylesheet" type="text/css"/>
    <!-- Icons CSS-->
    <link href="assets/css/icons.css" rel="stylesheet" type="text/css"/>
    <!-- Sidebar CSS-->
    <link href="assets/css/sidebar-menu.css" rel="stylesheet"/>
    <!-- Custom Style-->
    <link href="assets/css/app-style.css" rel="stylesheet"/>


</head>

<body>

<!-- Start wrapper-->
<div id="wrapper">

    <!--Start sidebar-wrapper-->
    <div id="sidebar-wrapper" data-simplebar="" data-simplebar-auto-hide="true">
        <div class="brand-logo">
            <a href="index.jsp">
                <img src="assets/images/logo-icon.png" class="logo-icon" alt="logo icon">
                <h5 class="logo-text">学生后台管理</h5>
            </a>
        </div>
        <ul class="sidebar-menu do-nicescrol">
            <li class="sidebar-header">目录</li>
            <li>
                <a href="javaScript:void(0);" class="waves-effect">
                    <i class="zmdi zmdi-layers"></i>
                    <span>用户管理</span>
                    <i class="fa fa-angle-left pull-right"></i>
                </a>
                <ul class="sidebar-submenu">
                    <li><a href="${pageContext.request.contextPath}/queryUserList"><i class="zmdi zmdi-star-outline"></i>用户信息预览</a></li>
                    <li><a href="user-add.jsp"><i class="zmdi zmdi-star-outline"></i>新增用户信息</a></li>
                </ul>
            </li>
            <li>
                <a href="javaScript:void(0);" class="waves-effect">
                    <i class="zmdi zmdi-layers"></i>
                    <span>课程管理</span>
                    <i class="fa fa-angle-left pull-right"></i>
                </a>
                <ul class="sidebar-submenu">
                    <li><a href="${pageContext.request.contextPath}/queryKe"><i class="zmdi zmdi-star-outline"></i>基本课程设置</a></li>
                    <li><a href="${pageContext.request.contextPath}/queryClassKe"><i class="zmdi zmdi-star-outline"></i>班级课程设置</a></li>
                </ul>
            </li>
            <li class="active">
                <a href="javaScript:void(0);" class="waves-effect">
                    <i class="zmdi zmdi-layers"></i>
                    <span>班级管理</span>
                    <i class="fa fa-angle-left pull-right"></i>
                </a>
                <ul class="sidebar-submenu">
                    <li class="active"><a href="${pageContext.request.contextPath}/queryClasses"><i class="zmdi zmdi-star-outline"></i>班级信息浏览</a></li>
                </ul>
            </li>
            <li>
                <a href="javaScript:void(0);" class="waves-effect">
                    <i class="zmdi zmdi-layers"></i>
                    <span>学籍管理</span>
                    <i class="fa fa-angle-left pull-right"></i>
                </a>
                <ul class="sidebar-submenu">
                    <li><a href="${pageContext.request.contextPath}/queryStudentList"><i class="zmdi zmdi-star-outline"></i>学籍信息浏览</a></li>
                    <li><a href="student-add.jsp"><i class="zmdi zmdi-star-outline"></i>新增学籍信息</a></li>
                </ul>
            </li>
            <li>
                <a href="javaScript:void(0);" class="waves-effect">
                    <i class="zmdi zmdi-layers"></i>
                    <span>学费管理</span>
                    <i class="fa fa-angle-left pull-right"></i>
                </a>
                <ul class="sidebar-submenu">
                    <li><a href="${pageContext.request.contextPath}/queryFeList"><i class="zmdi zmdi-star-outline"></i>基本学费设置</a></li>
                    <li><a href="${pageContext.request.contextPath}/queryStudentFeList"><i class="zmdi zmdi-star-outline"></i>学生缴费预览</a></li>
                </ul>
            </li>
            <li>
                <a href="javaScript:void(0);" class="waves-effect">
                    <i class="zmdi zmdi-layers"></i>
                    <span>成绩管理</span>
                    <i class="fa fa-angle-left pull-right"></i>
                </a>
                <ul class="sidebar-submenu">
                    <li><a href="${pageContext.request.contextPath}/queryCjList"><i class="zmdi zmdi-star-outline"></i>成绩信息浏览</a></li>
                    <li><a href="grade-add.jsp"><i class="zmdi zmdi-star-outline"></i>成绩信息添加</a></li>
                </ul>
            </li>
            <li>
                <a href="index.jsp" class="waves-effect">
                    <i class="zmdi zmdi-chart-donut text-success">
                    </i>
                    <span><font style="vertical-align: inherit;">
           <font style="vertical-align: inherit;">返回首页</font>
           </font>
         </span>
                </a>
            </li>
        </ul>

    </div>
    <!--End sidebar-wrapper-->

    <!--Start topbar header-->
    <header class="topbar-nav">
        <nav class="navbar navbar-expand fixed-top bg-white">
            <ul class="navbar-nav mr-auto align-items-center">
                <li class="nav-item">
                    <a class="nav-link toggle-menu" href="javascript:void(0);">
                        <i class="icon-menu menu-icon"></i>
                    </a>
                </li>
            </ul>
        </nav>
    </header>
    <!--End topbar header-->

    <div class="clearfix"></div>

    <div class="content-wrapper">
        <div class="container-fluid">
            <!--Start Dashboard Content-->
            <div class="col-lg-12">
                <div style="float: left">
                    <form class="form-inline" action="${pageContext.request.contextPath}/queryClassesByName" method="post">
                        <div class="form-group">
                            <label for="name">班级查询</label>
                            <input type="text" class="form-control" id="name" name="className" >
                        </div>
                        <button type="submit" class="btn btn-default">查询</button>
                    </form>
                </div>
                <div style="float: right;width: 150px;margin-right: 5px;margin-top: -7px;">
                    <button class="btn btn-info btn-block m-1" data-toggle="modal" data-target="#fullinfomodal"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">add</font></font></button>
                </div>
                <div class="modal fade" id="fullinfomodal">
                    <div class="modal-dialog" >
                        <div class="modal-content animated flipInX">
                            <div class="modal-header">
                                <h5 class="modal-title">添加班级</h5>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">×</span>
                                </button>
                            </div>
                            <div class="modal-body">
                                <form action="${pageContext.request.contextPath}/addClasses" method="post">
                                    <div class="form-group">
                                        <label for="className"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">班级名</font></font></label>
                                        <input required="required" type="text" class="form-control" id="className"   name="className" >
                                    </div>
                                    <div class="form-group">
                                        <label for="classTeacher"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">班主任</font></font></label>
                                        <input required="required" type="text" class="form-control" id="classTeacher"  name="classTeacher" >
                                    </div>
                                    <div class="form-group">
                                        <label for="classZuanYe"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">专业</font></font></label>
                                        <input required="required" type="text" class="form-control" id="classZuanYe"  name="classZuanYe" >
                                    </div>
                                    <div class="form-group">
                                        <button type="submit" class="btn btn-primary shadow-primary px-5"><i class="icon-lock"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">确认添加</font></font></button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <table class="table table-info table-striped shadow-info gradient-influenza">
                    <thead>
                    <tr>
                        <th scope="col">id</th>
                        <th scope="col">班级</th>
                        <th scope="col">班主任</th>
                        <th scope="col">专业</th>
                        <th scope="col" style="text-align: center">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${classesList}" var="classes" varStatus="s">
                        <tr>
                            <td scope="row">${s.count}</td>
                            <td>${classes.className}</td>
                            <td>${classes.classTeacher}</td>
                            <td>${classes.classZuanYe}</td>
                            <td>
                                <button type="button" onclick="queryClassesByID(${classes.classID})" class="btn btn-success btn-sm waves-effect waves-light m-1" data-toggle="modal" data-target="#modal-animation-1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">修改</font></font></button>
                                <a type="button" onclick="deleteClassesByID(${classes.classID}) " class="btn btn-danger btn-sm waves-effect waves-light m-1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">删除</font></font></a>
                            </td>
                            <div class="modal fade" id="modal-animation-1">
                                <div class="modal-dialog">
                                    <div class="modal-content animated flipInX">
                                        <div class="modal-header">
                                            <h5 class="modal-title">修改班级信息</h5>
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                <span aria-hidden="true">×</span>
                                            </button>
                                        </div>
                                        <div class="modal-body">
                                            <form action="${pageContext.request.contextPath}/updateClasses" method="post">
                                                <div class="form-group">
                                                    <label for="input-1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">班级名称</font></font></label>
                                                    <input type="text" class="form-control" id="input-1"  name="className" required="required">
                                                </div>
                                                <div class="form-group">
                                                    <label for="input-2"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">班主任</font></font></label>
                                                    <input type="text" class="form-control" id="input-2"  name="classTeacher" required="required">
                                                </div>
                                                <div class="form-group">
                                                    <label for="input-3"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">专业</font></font></label>
                                                    <input type="text" class="form-control" id="input-3"  name="classZuanYe" required="required">
                                                </div>
                                                <input type="hidden" name="classID" id="classID">
                                                <div class="form-group">
                                                    <button type="submit" class="btn btn-primary shadow-primary px-5"><i class="icon-lock"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">确认修改</font></font></button>
                                                </div>
                                            </form>

                                        </div>
                                    </div>
                                </div>
                            </div>
                        </tr>
                    </c:forEach>

                    </tbody>
                </table>
                <div id="test1"></div>
            </div>
            <!--End Dashboard Content-->

        </div>
        <!-- End container-fluid-->

    </div><!--End content-wrapper-->
    <!--Start Back To Top Button-->
    <a href="javaScript:void();" class="back-to-top"><i class="fa fa-angle-double-up"></i> </a>
    <!--End Back To Top Button-->


</div>

<!-- Bootstrap core JavaScript-->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

<!-- simplebar js -->
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
<!-- waves effect js -->
<script src="assets/js/waves.js"></script>
<!-- sidebar-menu js -->
<script src="assets/js/sidebar-menu.js"></script>
<!-- Custom scripts -->
<script src="assets/js/app-script.js"></script>
<!-- Chart js -->
<script src="assets/plugins/Chart.js/Chart.min.js"></script>
<!--Peity Chart -->
<script src="assets/plugins/peity/jquery.peity.min.js"></script>
<!-- Index js -->
<script src="assets/js/index.js"></script>
<script>
    function queryClassesByID(classID) {
        $.post("${pageContext.request.contextPath}/queryClassesByCID?classID="+classID,function (data) {
            data=JSON.parse(data);
            $("#input-1").val(data.className);
            $("#input-2").val(data.classTeacher);
            $("#input-3").val(data.classZuanYe);
            $("#classID").val(data.classID);
        })

    }
    function deleteClassesByID(classID) {
            if (confirm("你确定要删除吗")){
                location.href="${pageContext.request.contextPath}/deleteClassesByID?classID="+classID
            }
    }
</script>
</body>
</html>
